<?php
if (isset($_POST['sl_plasticType'])) {
    include 'rfq_do.php';
    if (isset($_POST['ck_masterbatch'])) {
        include         '../business/masterbatch_manager.php';
        include_once    '../entity/masterbatch_entity.php';

        $masterbatchEntity = new MasterbatchEntity();
        $masterbatchMng = new MasterbatchMng();

        $masterbatchEntity->id = "-1";
        $masterbatchEntity->rfqID = $rfqID;
        $masterbatchEntity->plasticType = $_POST['sl_plasticType'];
        $masterbatchEntity->meltFlow = $_POST['sl_meltFlow'];
        $masterbatchEntity->customerResin = $_POST['sl_customerResin'];
        $masterbatchEntity->heatStability = $_POST['sl_heatStability'];
        $masterbatchEntity->weatherStability = $_POST['sl_weatherStability'];
        $masterbatchEntity->lightFastness = $_POST['sl_lightFastness'];
        $masterbatchEntity->additionalFunction1 = $_POST['sl_additionalFunction1'];
        $masterbatchEntity->additionalFunction2 = $_POST['sl_additionalFunction2'];
        $masterbatchEntity->contactRating = $_POST['sl_contactRating'];
        $masterbatchEntity->inTime = time();
        $masterbatchEntity->inUser = $_SESSION['userID'];

        $masterbatchMng->update($masterbatchEntity);
    }
    if (isset($_POST['ck_compound'])) {
        include         '../business/compound_manager.php';
        include_once    '../entity/compound_entity.php';

        $compoundEntity = new CompoundEntity;
        $compoundMng = new CompoundMng();

        $compoundEntity->id = "-1";
        $compoundEntity->rfqID = $rfqID;
        $compoundEntity->color = $_POST['sl_color'];
        $compoundEntity->effect = $_POST['sl_effect'];
        $compoundEntity->application = $_POST['sl_application'];
        $compoundEntity->shade = $_POST['sl_shade'];
        $compoundEntity->exactness = $_POST['sl_exactness'];
        $compoundEntity->physicalProperty = $_POST['sl_physicalProperty'];
        $compoundEntity->translucency = $_POST['sl_translucency'];
        $compoundEntity->colorReference = $_POST['sl_colorReference'];
        $compoundEntity->inTime = time();
        $compoundEntity->inUser = $_SESSION['userID'];

        $compoundMng->update($compoundEntity);
    }
    echo "<script>window.location.href='rfq_submit.php'</script>";
} else {
    include 'common/smarty.php';
    $tpl->display('masterbatch_compound.html');
}
?>
